/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-07-03 09:41:54
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-07-03 15:05:13
 * @FilePath: \linePatrol\vue-element-plus-admin\src\api\equip\pipnet.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-07-03 09:41:54
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-07-03 10:56:33
 * @FilePath: \linePatrol\vue-element-plus-admin\src\api\equip\pipnet.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-05-28 11:29:08
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-07-03 09:42:16
 * @FilePath: \linePatrol\vue-element-plus-admin\src\api\linePatrol\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import service from '@/axios/http'
import { TableIResponse } from '@/utils/Api'
import { PnTopologyTreeType, PipeLineInfoType, PnLedgerListType } from './type'
export class PipnentInfoApi {
  //返回管网拓扑树结构
  async GetPnTopologyTree(): Promise<any> {
    const result = (await service.get('/api/patrol/pnTopology/pnTopologyTree')) as unknown as any
    return result
  }
  //查询查询设施类型列表

  async GetPnTopologyDetail(id: string): Promise<PnTopologyTreeType> {
    const result = (await service.get(`/api/patrol/pnTopology/${id}`)) as unknown as any
    const { code, data } = result
    if (code == 200) {
      return data
    } else {
      return {}
    }
  }
  //查询管线台账信息分页
  async GetPipeLineList(params: any): Promise<TableIResponse<PipeLineInfoType[]>> {
    const result = (await service.get('/api/patrol/pipeLine/list', { params })) as unknown as any
    return result
  }
  //修改管线台账
  async EditPipeLine(data: PipeLineInfoType): Promise<boolean> {
    const result = (await service.put('/api/patrol/pipeLine', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //删除管线台账
  async DeletPipeLine(uuids: string): Promise<boolean> {
    const result = (await service.delete(`/api/patrol/pipeLine/${uuids}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增新增管线拓扑
  async AddPnTopology(data: PnTopologyTreeType): Promise<boolean> {
    const result = (await service.post('/api/patrol/pnTopology', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }

  //修改管线拓扑
  async EditPnTopology(data: PnTopologyTreeType): Promise<boolean> {
    const result = (await service.put('/api/patrol/pnTopology', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //删除管线拓扑
  async DeletPnTopology(pnIds: string): Promise<boolean> {
    const result = (await service.delete(`/api/patrol/pnTopology/${pnIds}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }

  //查询管网台账信息
  async GetpnLedgerList(params: any): Promise<TableIResponse<PnLedgerListType[]>> {
    const result = (await service.get('/api/patrol/pnLedger/list', { params })) as unknown as any
    return result
  }
  //查询所有管网信息
  async GetpnLedgerListAll(): Promise<PnLedgerListType[]> {
    const result = (await service.get('/api/patrol/pnLedger/list')) as unknown as any
    return result.rows
  }
  //新增管网台账信息
  async AddPnLedgerConfig(data: PnLedgerListType): Promise<boolean> {
    const result = (await service.post('/api/patrol/pnLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //修改管网台账信息
  async EditPnLedgerConfig(data: PnLedgerListType): Promise<boolean> {
    const result = (await service.put('/api/patrol/pnLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //删除管网台账信息
  async DeletPnLedgerConfig(uuid: string): Promise<boolean> {
    const result = (await service.delete(`/api/patrol/pnLedger/${uuid}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
}
export default new PipnentInfoApi()
